﻿using Microsoft.AspNetCore.Mvc;
using Tauren.File.Infrastructure.Filter;
using Tauren.File.Service.FileVersionBLL;

namespace Tauren.File.Core.Controllers
{
    /// <summary>
    /// 在线保存数据
    /// </summary>
    [Route("api/filetrack")]
    [ApiController, Skip]
    [ApiVersion("1.0")]
    public class TrackController : ControllerBase
    {
        private ITrackFileService trackFileService;

        /// <summary>
        /// 构造函数
        /// </summary>  
        public TrackController(ITrackFileService _trackFileService)
        {
            this.trackFileService = _trackFileService;
        }
        /// <summary>
        /// 进行OnlyOffice数据回调结构
        /// </summary>
        /// <param name="fileid">文件ID</param>
        /// <param name="token">密钥</param>
        /// <returns></returns>
        [HttpPost, Route("v{version}/track"), ApiVersion("1.0")]
        public string TrackFile([FromQuery] long fileid, [FromQuery] string token)
        {
            return this.trackFileService.TrackFile(fileid: fileid, token: token);
        }
    }
}
